<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>我是3000端口</h1>
    <button class="btn1">点我请求4000端口</button>
    <button class="btn2">点我请求3000端口</button>
    <button class="btn3">点我请求new端口</button>
</body>
    <script>
        let btn1 = document.querySelector(".btn1")
        btn1.onclick = function(){
            const xhr = new XMLHttpRequest();
            xhr.open("get","http://192.168.58.113:4000/");
            xhr.setRequestHeader("Content-Type","charset=utf-8");
            xhr.onload= function(){
             
            }
            xhr.send()
        }
        let btn2 = document.querySelector(".btn2")
        btn2.onclick = function(){
            const xhr = new XMLHttpRequest();
            xhr.open("get","/go3000");
            xhr.onload= function(){
                let res =JSON.parse(xhr.responseText)              
                console.log(res.info);
            }
            xhr.send()
        }
    </script>
</html>